package zxr.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import zxr.Student;
import zxr.demo.Rundemo1;
import zxr.demo.Rundemo2;

import java.io.IOException;

@Controller
@RequestMapping("/student")
public class StudentController {
    public int flag = 0;


//  @Resource
//    private StudentService studentService;

    @RequestMapping("/add01")
    public void add01(String name, String englishName, String address,
                       String phoneNumber) {
        System.out.println(name);
        System.out.println(englishName);
        System.out.println(address);
        System.out.println(phoneNumber);
    }

    @RequestMapping("/add")
    public void add(Student student) throws IOException {
        System.out.println(student.toString());
        student.setName(student.getName());
        student.setEnglishName(student.getEnglishName());
        student.setAddress(student.getAddress());
        student.setPhoneNumber(student.getPhoneNumber());
        Rundemo1 rd1 = new Rundemo1();
        rd1.run(student);

    }

    @RequestMapping("/update")
    public void update(Student student) throws IOException {
        student.setId(student.getId());
        student.setName(student.getName());
        student.setEnglishName(student.getEnglishName());
        student.setAddress(student.getAddress());
        student.setPhoneNumber(student.getPhoneNumber());

        Rundemo2 rd2 = new Rundemo2();
        rd2.run(student);

    }




}
